package com.sf.osms.dep.domain;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Polymorphism;
import org.hibernate.annotations.PolymorphismType;

import com.sf.novatar.base.domain.LongIdBean;
import com.sf.osms.dep.groovy.GroovyInterface;

@Entity
@Table(name = "wbs_tt_agent")
@Polymorphism(type = PolymorphismType.EXPLICIT)
public class Agent extends LongIdBean implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	/**
	 * ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	private Long id;
	/**
	 * 代理名称
	 */
	@Column(name = "NAME")
	private String name; 
	/**
	 * 代理国家
	 */
	@Column(name = "COUNTRY")
	private String country; 
	/**
	 * 国家名称
	 */
	@Transient
	private String countryName;
	/**
	 * 车标号生成规制
	 */
	@Column(name = "CARNO_TYPE")
	private String carnoType; 
	/**
	 * 代理上传文件路径
	 */
	@Column(name = "UPLOAD_PATH")
	private String uploadPath;
	/**
	 * 备份代理文件路径
	 */
	@Column(name = "BACK_PATH")
	private String backPath; 
	/**
	 * 错误文件路径
	 */
	@Column(name = "ERROR_PATH")
	private String errorPath; 
	/**
	 * 代理是否需要回单
	 */
	@Column(name = "POD_FLAG")
	private String podFlag; 
	
	/**
	 * 代理是否被删除，1代表被删除，0代表没有
	 */
	@Column(name = "is_deleted")
	private Long isDeleted; 
	
	/**
	 * 网点号
	 */
	@Column(name = "net_num")
	private String netNum; 
	
	/**
	 * 操作员编号
	 */
	@Column(name = "operator_id")
	private String operatorId; 
	
	/**
	 * 代理草签
	 */
	@Column(name = "pod_sign")
	private String podSign;
	/**
	 * 代理对应的配置信息
	 */
	@Transient
	private List<AgentConfig> agentCofigs;
	
	/**
	 * 代理对应的文件映射信息
	 */
	@Transient
	private AgentFileMap agentFileMap;
	
	
	/**
	 * 用于测试的代理标识
	 */
	@Transient
	private Integer agentFlag;
	
	/**
	 * groovy脚本位置
	 */
	@Column(name = "groovy_file_path")
	private String groovyFilePath;
	
	/**
	 * 代理cron表达式
	 */
	@Column(name = "cron_expression")
	private String cronExpression;
	
	/**
	 * 时区转换
	 */
	@Column(name = "time_zone_tranfer")
	private Integer timeZoneTranfer;
	
	/**
	 * 代理邮件集合，多个邮件名称用;分隔
	 */
	@Column(name = "agent_email_set")
	private String agentEmailSet;
	
	public Integer getTimeZoneTranfer() {
		return timeZoneTranfer;
	}
	public void setTimeZoneTranfer(Integer timeZoneTranfer) {
		this.timeZoneTranfer = timeZoneTranfer;
	}
	public String getAgentEmailSet() {
		return agentEmailSet;
	}
	public void setAgentEmailSet(String agentEmailSet) {
		this.agentEmailSet = agentEmailSet;
	}
	public String getCronExpression() {
		return cronExpression;
	}
	public void setCronExpression(String cronExpression) {
		this.cronExpression = cronExpression;
	}
	/**
	 * groovy脚本对应的接口
	 */
	@Transient
	private GroovyInterface gif;
	
	public String getGroovyFilePath() {
		return groovyFilePath;
	}
	public void setGroovyFilePath(String groovyFilePath) {
		this.groovyFilePath = groovyFilePath;
	}
	public GroovyInterface getGif() {
		return gif;
	}
	public void setGif(GroovyInterface gif) {
		this.gif = gif;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getCountryName() {
		return countryName;
	}
	public void setCountryName(String countryName) {
		this.countryName = countryName;
	}
	public String getCarnoType() {
		return carnoType;
	}
	public void setCarnoType(String carnoType) {
		this.carnoType = carnoType;
	}
	public String getUploadPath() {
		return uploadPath;
	}
	public void setUploadPath(String uploadPath) {
		this.uploadPath = uploadPath;
	}
	public String getBackPath() {
		return backPath;
	}
	public void setBackPath(String backPath) {
		this.backPath = backPath;
	}
	public String getErrorPath() {
		return errorPath;
	}
	public void setErrorPath(String errorPath) {
		this.errorPath = errorPath;
	}
	public String getPodFlag() {
		return podFlag;
	}
	public void setPodFlag(String podFlag) {
		this.podFlag = podFlag;
	}
	public List<AgentConfig> getAgentCofigs() {
		return agentCofigs;
	}
	public void setAgentCofigs(List<AgentConfig> agentCofigs) {
		this.agentCofigs = agentCofigs;
	}
	public AgentFileMap getAgentFileMap() {
		return agentFileMap;
	}
	public void setAgentFileMap(AgentFileMap agentFileMap) {
		this.agentFileMap = agentFileMap;
	}
	public Long getIsDeleted() {
		return isDeleted;
	}
	public void setIsDeleted(Long isDeleted) {
		this.isDeleted = isDeleted;
	}
	
	public String getNetNum() {
		return netNum;
	}
	public String getOperatorId() {
		return operatorId;
	}
	public void setNetNum(String netNum) {
		this.netNum = netNum;
	}
	public void setOperatorId(String operatorId) {
		this.operatorId = operatorId;
	}
	public Integer getAgentFlag() {
		return agentFlag;
	}
	public void setAgentFlag(Integer agentFlag) {
		this.agentFlag = agentFlag;
	}
	
	public String getPodSign() {
		return podSign;
	}
	public void setPodSign(String podSign) {
		this.podSign = podSign;
	}
	@Override
	public String toString() {
		return "Agent [id=" + id + ", name=" + name + ", country=" + country
				+ ", carnoType=" + carnoType + ", uploadPath=" + uploadPath
				+ ", backPath=" + backPath + ", errorPath=" + errorPath
				+ ", podFlag=" + podFlag + ", isDeleted=" + isDeleted
				+ ", netNum=" + netNum + ", operatorId=" + operatorId + "]";
	}
	
	
}
